﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Tanmia.Warehouse.Core;
using FluentNHibernate.Mapping;

namespace Tanmia.Warehouse.NHibernateRepository.Mapping
{
    public class ZoneMap : ClassMap<Zone>
    {
        public ZoneMap()
        {
            Table("Zone");

            Id(x => x.ZoneID).GeneratedBy.Identity().Unique();

            Map(x => x.Name).Not.Nullable().CustomType(typeof(string));
            Map(x => x.Abbreviation).CustomType(typeof(string));
            HasMany<Section>(x => x.Subsection).KeyColumn("ZoneID").Inverse();
        }
    }
}
